package control;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

// 分隔窗体
public class SplitPaneDemo extends Application {
	private Pane root = new Pane();
	private SplitPane sp;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		sp = new SplitPane();
		sp.setPrefSize(300, 250);	
		root.getChildren().add(sp);
		
		StackPane stackPane1 = new StackPane();
		stackPane1.setMinWidth(100);		// 设置最小宽度
		stackPane1.getChildren().add(new Button("stackPane1"));
		StackPane stackPane2 = new StackPane();
		stackPane2.setMinWidth(100);
		stackPane2.getChildren().add(new Button("stackPane2"));
		sp.getItems().addAll(stackPane1, stackPane2);			// 添加面板才能拉动
		
		Scene scene = new Scene(root, 300, 250);
		stage.setScene(scene);
		stage.show();
	}
}
